﻿function addTab(tabPanel, title, url) {
    var tab = tabPanel.getComponent(url);
    if (!tab) {
        tab = tabPanel.add({
            id: url,
            title: title,
            closable: true,
            //menuItem: menuItem,
            loader: {
                url: url,
                renderer: "frame",
                loadMask: {
                    showMask: true,
                    msg: "Loading " + url + "..."
                }
            }
        });
    }
    tabPanel.setActiveTab(tab);
}

function showWindow(title, url, modal, w, h) {
    if (h <= 1) {
        h = Ext.getBody().getViewSize().height * h;
    }
    if (w <= 1) {
        w = Ext.getBody().getViewSize().width * w;
    }


    var winObj = Ext.create('Ext.window.Window', {
        width: w,
        height: h,
        maximizable: false,
        modal: modal,
        loader: {
            url: url,
            renderer: "frame",
            loadMask: {
                showMask: true,
                msg: "Loading..."
            }
        },
        title: title,
        bodyStyle: 'background:#fff;'
        //        buttons: [{
        //            text: 'Close',
        //            handler: function () {
        //                winObj.hide(); // hides the window // you can also use close() in case you want to get rid of this El from DOM
        //            }
        //        }]
    }).show();
}
function showLog(logid) {
    showWindow("Log", "/Views/Log/?LogID=" + logid, true, 500, 350);
}